<template>
	<view>
		<!-- 自定义导航栏 -->
		<u-navbar :is-back="false" title="老挝韻達快递" :background="{backgroundColor:'#f7c60a'}" title-color='black' title-size="36"
		 title-width="auto">
		</u-navbar>

		<!-- tabs -->
		<u-tabs :list="list" :is-scroll="false" :current="current" @change="change" active-color='#f7c60a'></u-tabs>
		<order-list v-if="current===0" />
		<add-order v-if="current===1" />
		<edit-order v-if="current===2" />
		<online v-if="current===3" />
	</view>
</template>

<script>
	import AddOrder from './add_order/index.vue'
	import OrderList from './order_list/index.vue'
	import EditOrder from './edit_order/index.vue'
	import Online from './online/index.vue'

	export default {
		name: 'Order',
		components: {
			AddOrder,
			OrderList,
			EditOrder,
			Online
		},
		data() {
			return {
				list: [{
					name: '订单列表'
				}, {
					name: '添加订单'
				}, {
					name: '编辑订单'
				}, {
					name: '在线下单'
				}],
				current: 0
			};
		},
		methods: {
			change(index) {
				this.current = index;
			}
		},
		onShow() {
			uni.openBluetoothAdapter({ // 初始化蓝牙模块
				success: function(res) {
					console.log(res)
				},
				fail: function(err) {
					console.log('设备蓝牙未开启')
				}
			})
		}
	}
</script>
